using System;
using System.Collections.Generic;
using UnityDemo.AutomaticFactoryCode;
using UnityDemo.DesignPatternSamples;
using UnityDemo.InjectionCode;
using UnityDemo.InstanceManagerCode;
using UnityDemo.Models;
using UnityDemo.RegAndResCode;

namespace UnityDemo.ConsolePresenter
{
    internal class FeatureList
    {
        private Dictionary<int, Lazy<BaseFeatureDemo>> _demoss;

        private IDictionary<int, Lazy<BaseFeatureDemo>> Demos
        {
            get
            {
                if (_demoss != null)
                    return _demoss;

                _demoss = new Dictionary<int, Lazy<BaseFeatureDemo>>();
                //First demo
                _demoss[1] = new Lazy<BaseFeatureDemo>(() => new RegisterAndResolveDemo());

                //Second demo
                _demoss[2] = new Lazy<BaseFeatureDemo>(() => new LifeTimeDemo());

                //Third demo
                _demoss[3] = new Lazy<BaseFeatureDemo>(() => new DesignPatternFeature());

                //Fourth Demo
                _demoss[4] = new Lazy<BaseFeatureDemo>(() => new AutomaticFactoryDemo());

                //Sixth Demo
                _demoss[5] = new Lazy<BaseFeatureDemo>(() => new DependencyAttributeDemo());

                // Seventh Demo
                _demoss[6] = new Lazy<BaseFeatureDemo>(() => new InterceptionDemo());

                return _demoss;
            }
        }

        public BaseFeatureDemo this[int index]
        {
            get { return Demos[index].Value; }
        }
    }
}